import pandas as pd
import numpy as np

import calendar
tmpl_no = '202402_01'
year_str = tmpl_no[0:4]
month_str = tmpl_no[4:6]
year_tmp = int(year_str)
month_tmp = int(month_str)
days_tmp = calendar.monthrange(year_tmp, month_tmp)[1]
print(days_tmp)



data_jiaotancanshu = pd.read_excel('COKE2参数.xlsx')
data_jiaotancanshu.columns = data_jiaotancanshu.columns.str.upper()
parm_1 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_1')]
parm_1 = parm_1['PARM_CALC'].values[0]
parm_2 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_2')]
parm_2 = parm_2['PARM_CALC'].values[0]
parm_3 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_3')]
parm_3 = parm_3['PARM_CALC'].values[0]
parm_4 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_4')]
parm_4 = parm_4['PARM_CALC'].values[0]
parm_5 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_5')]
parm_5 = parm_5['PARM_CALC'].values[0]
parm_6 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_6')]
parm_6 = parm_6['PARM_CALC'].values[0]
parm_7 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_7')]
parm_7 = parm_7['PARM_CALC'].values[0]
parm_8 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_8')]
parm_8 = parm_8['PARM_CALC'].values[0]
parm_10 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_10')]
parm_10 = parm_10['PARM_CALC'].values[0]
parm_11 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_11')]
parm_11 = parm_11['PARM_CALC'].values[0]
parm_12 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_12')]
parm_12 = parm_12['PARM_CALC'].values[0]
parm_13 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_13')]
parm_13 = parm_13['PARM_CALC'].values[0]
parm_14 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_14')]
parm_14 = parm_14['PARM_CALC'].values[0]
parm_15 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_15')]
parm_15 = parm_15['PARM_CALC'].values[0]
parm_16 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_16')]
parm_16 = parm_16['PARM_CALC'].values[0]
parm_17 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_17')]
parm_17 = parm_17['PARM_CALC'].values[0]
parm_19 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_19')]
parm_19 = parm_19['PARM_CALC'].values[0]
parm_20 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_20')]
parm_20 = parm_20['PARM_CALC'].values[0]
parm_21 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_21')]
parm_21 = parm_21['PARM_CALC'].values[0]
parm_22 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_22')]
parm_22 = parm_22['PARM_CALC'].values[0]
parm_23 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_23')]
parm_23 = parm_23['PARM_CALC'].values[0]
parm_24 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_24')]
parm_24 = parm_24['PARM_CALC'].values[0]
parm_25 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_25')]
parm_25 = parm_25['PARM_CALC'].values[0]
parm_26 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_26')]
parm_26 = parm_26['PARM_CALC'].values[0]
parm_27 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_27')]
parm_27 = parm_27['PARM_CALC'].values[0]
parm_28 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_28')]
parm_28 = parm_28['PARM_CALC'].values[0]
parm_29 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_29')]
parm_29 = parm_29['PARM_CALC'].values[0]

parm_31 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_31')]
parm_31 = parm_31['PARM_CALC'].values[0]
parm_32 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_32')]
parm_32 = parm_32['PARM_CALC'].values[0]
parm_33 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_33')]
parm_33 = parm_33['PARM_CALC'].values[0]
parm_34 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_34')]
parm_34 = parm_34['PARM_CALC'].values[0]
parm_35 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_35')]
parm_35 = parm_35['PARM_CALC'].values[0]
parm_36 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_36')]
parm_36 = parm_36['PARM_CALC'].values[0]
parm_37 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_37')]
parm_37 = parm_37['PARM_CALC'].values[0]
parm_38 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_38')]
parm_38 = parm_38['PARM_CALC'].values[0]
parm_39 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_39')]
parm_39 = parm_39['PARM_CALC'].values[0]
parm_40 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_40')]
parm_40 = parm_40['PARM_CALC'].values[0]
parm_41 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_41')]
parm_41 = parm_41['PARM_CALC'].values[0]
parm_42 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_42')]
parm_42 = parm_42['PARM_CALC'].values[0]
parm_43 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_43')]
parm_43 = parm_43['PARM_CALC'].values[0]
parm_44 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_44')]
parm_44 = parm_44['PARM_CALC'].values[0]
parm_45 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_45')]
parm_45 = parm_45['PARM_CALC'].values[0]
parm_46 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_46')]
parm_46 = parm_46['PARM_CALC'].values[0]
parm_47 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_47')]
parm_47 = parm_47['PARM_CALC'].values[0]
parm_48 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'parm_48')]
parm_48 = parm_48['PARM_CALC'].values[0]
QRT1 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'QRT1')]
QRT1 = QRT1['PARM_CALC'].values[0]
QRT2 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'QRT2')]
QRT2 = QRT2['PARM_CALC'].values[0]
QRT3 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'QRT3')]
QRT3 = QRT3['PARM_CALC'].values[0]
QRT4 = data_jiaotancanshu[(data_jiaotancanshu['PARM_CHN'] == 'QRT4')]
QRT4 = QRT4['PARM_CALC'].values[0]
peihemei_hui_tmp = 9.782
peihemei_huifa_tmp = 25.099
peihemei_liu_tmp = 0.947
peihemei_hui_FE2O3 = 5.617
peihemei_hui_K2O = 0.712
peihemei_hui_NA2O = 0.829
peihemei_hui_CAO = 4.323
peihemei_hui_MGO = 1.185
peihemei_hui_SIO2 = 51.103
peihemei_hui_AL2O3 = 32.718
peihemei_hui_TIO2 = 1.597
QRT2 = 0
QRT3 = 0
peihemei_liudong_tmp = 2.671
peihemei_meiyan_Ti = 27.899
peihemei_meiyan_R = 1.085
jiaotan_hui = parm_1 + parm_2 * (peihemei_hui_tmp)/(100 - peihemei_huifa_tmp) + parm_3 * (peihemei_huifa_tmp)
jiaotan_liu = parm_4 + parm_5 * (peihemei_liu_tmp)/(100 - peihemei_huifa_tmp) - parm_6 * (peihemei_huifa_tmp)
mci = peihemei_hui_tmp*(peihemei_hui_FE2O3*parm_37+peihemei_hui_K2O*parm_38+peihemei_hui_NA2O*parm_39+peihemei_hui_CAO*parm_40+peihemei_hui_MGO*parm_41)/(100-peihemei_huifa_tmp)/(peihemei_hui_SIO2*parm_42+peihemei_hui_AL2O3*parm_43+peihemei_hui_TIO2*parm_44)
jiaotan_csr = parm_17 * QRT2 - parm_19 * mci + parm_20 * (peihemei_huifa_tmp) - parm_21 * (
    peihemei_huifa_tmp) * (peihemei_huifa_tmp) + parm_22 * (peihemei_liudong_tmp) - parm_23 * (
                  peihemei_liudong_tmp) * (peihemei_liudong_tmp) - parm_24 * (peihemei_liudong_tmp) * (
                  peihemei_huifa_tmp) + parm_25 * peihemei_meiyan_Ti - parm_26
jiaotan_cri = parm_27 * mci - parm_28 - parm_29 * QRT3 + parm_31 * peihemei_meiyan_R - parm_45 * peihemei_meiyan_R * peihemei_meiyan_R - parm_46 * peihemei_liudong_tmp + parm_47 * peihemei_liudong_tmp * peihemei_meiyan_R - parm_48 * peihemei_meiyan_Ti



print('finish')